/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Init_Window.java
 *
 * Created on 05-22-2012, 12:18:24 AM
 */
package init;

import Logic.MessageBox;
import Logic.*;
import de.javasoft.plaf.synthetica.SyntheticaBlackStarLookAndFeel;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.geom.Ellipse2D;
import java.awt.geom.RoundRectangle2D;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.ParseException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author TuxCompany
 */
public class Init_Window extends javax.swing.JFrame {

    /**
     * Creates new form Init_Window
     */
    private boolean isShapingSupported;
    private boolean isOpacityControlSupported;
    private boolean isTranslucencySupported;
    private GraphicsConfiguration translucencyCapableGC;
    private MainDesign fancyFrame = null;
    private ComponentListener shapeListener = null;

    private synchronized void applyOpacity() {
        if (!isOpacityControlSupported) {
            return;
        }
        if (opacitySlider.getValueIsAdjusting()) {
            return;
        }
        if (fancyFrame == null) {
            return;
        }
        AWTUtilitiesWrapper.setWindowOpacity(fancyFrame, ((float) opacitySlider.getValue()) / 100.0f);
    }

    private synchronized void applyShape() {
        if (!isShapingSupported) {
            return;
        }
        if (fancyFrame == null) {
            return;
        }
        if (shapeListener != null) {
            shapeListener.componentResized(null);
            return;
        }

        final MainDesign fd = fancyFrame;

        fd.addComponentListener(shapeListener = new ComponentAdapter() {

            @Override
            public void componentResized(ComponentEvent evt) {
                Shape shape = null;

                if (roundedCornersShapeRadioButton.isSelected()) {
                    shape = new RoundRectangle2D.Float(0, 0, fd.getWidth(), fd.getHeight(), 30, 30);
                } else if (ovalShapeRadioButton.isSelected()) {
                    shape = new Ellipse2D.Float(0, 0, fd.getWidth(), fd.getHeight());
                }

                AWTUtilitiesWrapper.setWindowShape(fd, shape);
            }
        });
    }

    public Init_Window() {
        setSyntheticaBlueMoonLF();
        initComponents();
        // conexion.Conectar("root", "23466");

//        isShapingSupported = AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.PERPIXEL_TRANSPARENT);
//        isOpacityControlSupported = AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.TRANSLUCENT);
//        isTranslucencySupported = AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.PERPIXEL_TRANSLUCENT);
//
//        translucencyCapableGC = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
//        if (!AWTUtilitiesWrapper.isTranslucencyCapable(translucencyCapableGC)) {
//            translucencyCapableGC = null;
//
//            GraphicsEnvironment env =
//                    GraphicsEnvironment.getLocalGraphicsEnvironment();
//            GraphicsDevice[] devices = env.getScreenDevices();
//
//            for (int i = 0; i < devices.length && translucencyCapableGC == null; i++) {
//                GraphicsConfiguration[] configs = devices[i].getConfigurations();
//                for (int j = 0; j < configs.length && translucencyCapableGC == null; j++) {
//                    if (AWTUtilitiesWrapper.isTranslucencyCapable(configs[j])) {
//                        translucencyCapableGC = configs[j];
//                    }
//                }
//            }
//            if (translucencyCapableGC == null) {
//                isTranslucencySupported = false;
//            }
//        }
//
//        if (!isShapingSupported) {
//            plainRectangularShapeRadioButton.setSelected(true);
//        } else {
//            roundedCornersShapeRadioButton.setSelected(true);
//        }
//        plainRectangularShapeRadioButton.setEnabled(isShapingSupported);
//        roundedCornersShapeRadioButton.setEnabled(isShapingSupported);
//        ovalShapeRadioButton.setEnabled(isShapingSupported);
//
//        if (!isOpacityControlSupported) {
//            opacitySlider.setValue(100);
//        } else {
//            opacitySlider.setValue(75);
//        }
//        opacitySlider.setEnabled(isOpacityControlSupported);
//
//        translucencyCheckBox.setSelected(isTranslucencySupported);
//        translucencyCheckBox.setEnabled(isTranslucencySupported);
    }

    private void setSyntheticaBlueMoonLF() {
        try {
            UIManager.setLookAndFeel(new SyntheticaBlackStarLookAndFeel());
            SwingUtilities.updateComponentTreeUI(this);
        } catch (Exception e) {
           // e.printStackTrace();
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        closeApplicationButton = new javax.swing.JButton();
        paintGradientCheckBox = new javax.swing.JCheckBox();
        translucencyCheckBox = new javax.swing.JCheckBox();
        showFancyFrameButton = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        opacitySlider = new javax.swing.JSlider();
        jPanel3 = new javax.swing.JPanel();
        plainRectangularShapeRadioButton = new javax.swing.JRadioButton();
        roundedCornersShapeRadioButton = new javax.swing.JRadioButton();
        ovalShapeRadioButton = new javax.swing.JRadioButton();
        jPanel1 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtUser = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtPsw = new javax.swing.JPasswordField();
        jPanel5 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        btnConfirmar = new javax.swing.JButton();
        lblStatus = new javax.swing.JLabel();

        closeApplicationButton.setText("Close the application");
        closeApplicationButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                closeApplicationButtonActionPerformed(evt);
            }
        });

        paintGradientCheckBox.setSelected(true);
        paintGradientCheckBox.setText("Paint gradient");

        translucencyCheckBox.setSelected(true);
        translucencyCheckBox.setText("Enable the per-pixel translucency effect");

        showFancyFrameButton.setText("Display the frame");
        showFancyFrameButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showFancyFrameButtonActionPerformed(evt);
            }
        });

        jLabel3.setText("Use controls below to define the appearance of the frame.");

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Constant opacity level"));

        opacitySlider.setMajorTickSpacing(10);
        opacitySlider.setMinorTickSpacing(1);
        opacitySlider.setPaintLabels(true);
        opacitySlider.setPaintTicks(true);
        opacitySlider.setSnapToTicks(true);
        opacitySlider.setValue(75);
        opacitySlider.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                opacitySliderStateChanged(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(opacitySlider, javax.swing.GroupLayout.DEFAULT_SIZE, 482, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(opacitySlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Shape of the frame"));

        plainRectangularShapeRadioButton.setText("Plain rectangular");
        plainRectangularShapeRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                plainRectangularShapeRadioButtonshapeRadioButtonStateChanged(evt);
            }
        });

        roundedCornersShapeRadioButton.setSelected(true);
        roundedCornersShapeRadioButton.setText("Rounded corners");
        roundedCornersShapeRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                roundedCornersShapeRadioButtonshapeRadioButtonStateChanged(evt);
            }
        });

        ovalShapeRadioButton.setText("Oval");
        ovalShapeRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                ovalShapeRadioButtonshapeRadioButtonStateChanged(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(plainRectangularShapeRadioButton)
                    .addComponent(roundedCornersShapeRadioButton)
                    .addComponent(ovalShapeRadioButton))
                .addContainerGap(364, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(plainRectangularShapeRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(roundedCornersShapeRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ovalShapeRadioButton))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setIconImage( This.getIconImageFrame());
        setResizable(false);
        setUndecorated(true);

        jPanel1.setBackground(java.awt.SystemColor.desktop);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 260, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 9, Short.MAX_VALUE)
        );

        jPanel4.setBackground(java.awt.SystemColor.desktop);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 260, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        jLabel1.setText("Usuario");
        jLabel1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        txtUser.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtUserKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtUserKeyTyped(evt);
            }
        });

        jLabel2.setText("Contraseña");

        txtPsw.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtPswKeyTyped(evt);
            }
        });

        jPanel5.setBackground(new java.awt.Color(96, 114, 114));
        jPanel5.setPreferredSize(new java.awt.Dimension(376, 5));

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 260, Short.MAX_VALUE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 5, Short.MAX_VALUE)
        );

        jButton1.setText("Cancelar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        btnConfirmar.setText("Confirmar");
        btnConfirmar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnConfirmarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel1))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtPsw, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
                            .addComponent(txtUser, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(btnConfirmar, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(lblStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel2)
                    .addComponent(txtPsw, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(btnConfirmar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        java.awt.Dimension dialogSize = getSize();
        setLocation((screenSize.width-dialogSize.width)/2,(screenSize.height-dialogSize.height)/2);
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        Exit.Ok();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void btnConfirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConfirmarActionPerformed
        // TODO add your handling code here:
        LoadSesion();
    }//GEN-LAST:event_btnConfirmarActionPerformed

    private void closeApplicationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeApplicationButtonActionPerformed
        setVisible(false);
        System.exit(0);
    }//GEN-LAST:event_closeApplicationButtonActionPerformed

    private void showFancyFrameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showFancyFrameButtonActionPerformed
    }//GEN-LAST:event_showFancyFrameButtonActionPerformed

    private void opacitySliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_opacitySliderStateChanged
        applyOpacity();
    }//GEN-LAST:event_opacitySliderStateChanged

    private void plainRectangularShapeRadioButtonshapeRadioButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_plainRectangularShapeRadioButtonshapeRadioButtonStateChanged
        applyShape();
    }//GEN-LAST:event_plainRectangularShapeRadioButtonshapeRadioButtonStateChanged

    private void roundedCornersShapeRadioButtonshapeRadioButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_roundedCornersShapeRadioButtonshapeRadioButtonStateChanged
        applyShape();
    }//GEN-LAST:event_roundedCornersShapeRadioButtonshapeRadioButtonStateChanged

    private void ovalShapeRadioButtonshapeRadioButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_ovalShapeRadioButtonshapeRadioButtonStateChanged
        applyShape();
    }//GEN-LAST:event_ovalShapeRadioButtonshapeRadioButtonStateChanged

    private void txtPswKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPswKeyTyped
        // TODO add your handling code here:
        if (This.Enter(evt)) {
            LoadSesion();
        }
    }//GEN-LAST:event_txtPswKeyTyped

    private void txtUserKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtUserKeyTyped
        // TODO add your handling code here:
        if (This.Enter(evt)) {
            if (txtUser.getText().trim().length() > 0) {
                txtPsw.requestFocus();
            }
        }
    }//GEN-LAST:event_txtUserKeyTyped

    private void txtUserKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtUserKeyReleased
        // TODO add your handling code here:
        txtUser.setText(txtUser.getText().toUpperCase());
    }//GEN-LAST:event_txtUserKeyReleased

    private void LoadSesion() {
        //This.show(new MainDesign());
        try {
            if (!btnConfirmar.isEnabled()) {
                return;
            }
            btnConfirmar.setEnabled(false);
            String Usr, Psw;
            Usr = this.txtUser.getText();
            Psw = String.valueOf(this.txtPsw.getPassword());
            Statement consulta = Conectividad.Conector.createStatement();
            ResultSet resultado = consulta.executeQuery("SELECT * FROM USER_DB WHERE UPPER(COD_USR)='" + Usr.toUpperCase() + "' AND PSW_USR=MD5('" + Psw + "')");
            boolean Status = false;
            while (resultado.next()) {
                if (resultado.getString(1).trim().equals(Usr)) {
                    Status = true;
                }
                if (resultado.getInt(3) == 0) {
                    AccessFrame.ATotal = 1;//Acceso a Administrador
                }
            }
            if (!Status) {
                MessageBox.show(this, "Error", "Usuario/Contraseña Incorrect@", MessageBox.Error);
                btnConfirmar.setEnabled(true);
            } else {
                //This.show(new MainDesign());
                //LoadMainDesign();
                Thread TheadCode = new Thread(new Runnable() {

                    public void run() {
                        lblStatus.setText("Cargando Componentes...");
                    }
                });
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException ex) {
                    //Logger.getLogger(Init_Window.class.getName()).log(Level.SEVERE, null, ex);
                }
                final javax.swing.JFrame JF = this;
                TheadCode.start();

                Thread TheadCode2 = new Thread(new Runnable() {

                    public void run() {
                        new MainDesign(null, true).setVisible(true);
                        This.hide(JF);
                    }
                });
                TheadCode2.start();

            }
        } catch (SQLException ex) {
            Logger.getLogger(Init_Window.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void LoadMainDesign() {
        synchronized (this) {
            if (fancyFrame == null) {
                fancyFrame = new MainDesign(
                        translucencyCheckBox.isSelected() ? translucencyCapableGC : null,
                        paintGradientCheckBox.isSelected());
                if (translucencyCheckBox.isSelected()) {
                    AWTUtilitiesWrapper.setWindowOpaque(fancyFrame, false);
                }
                translucencyCheckBox.setEnabled(false);
                applyOpacity();
                applyShape();
                fancyFrame.setVisible(true);
                showFancyFrameButton.setText("Hide the frame");
            } else {
                fancyFrame.setVisible(false);
                fancyFrame.dispose();
                fancyFrame = null;
                shapeListener = null;
                translucencyCheckBox.setEnabled(isTranslucencySupported);
                showFancyFrameButton.setText("Display the frame");
            }
        }
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        UIManager.put("swing.boldMetal", Boolean.FALSE);
        //SwingUtilities.updateComponentTreeUI(this);
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Init_Window().setVisible(true);
                //Carga de Parametros Globales
                new AccessFrame().LoadParameters();
                //PARAMETROS QUE DEFINEN LA CONEXION A LA BASE DE DATOS MYSQL
                Conectividad.Conectar("root", "23466");
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnConfirmar;
    private javax.swing.JButton closeApplicationButton;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JLabel lblStatus;
    private javax.swing.JSlider opacitySlider;
    private javax.swing.JRadioButton ovalShapeRadioButton;
    private javax.swing.JCheckBox paintGradientCheckBox;
    private javax.swing.JRadioButton plainRectangularShapeRadioButton;
    private javax.swing.JRadioButton roundedCornersShapeRadioButton;
    private javax.swing.JButton showFancyFrameButton;
    private javax.swing.JCheckBox translucencyCheckBox;
    private javax.swing.JPasswordField txtPsw;
    private javax.swing.JTextField txtUser;
    // End of variables declaration//GEN-END:variables
}
